<?php

/**
 *    The reporter factory get the reporter for the 
 *    test result print
 */

class Reporter_Factory{
    private function __construct(){}
    private function __clone(){}

    /**
     *    @return Report
     *    @access public static
     */
    public static function getReporter(){
        if(QStone_Context::inCli()){
            $parser = new QStone_CommandLineParser($_SERVER['argv']);
            if($parser->help()){
                echo $parser->getHelpText();
                exit(1);
            }
            $reporter = $parser->isXml() ? Reporter_Xml::getInstance() : $parser->isConfig() ? Reporter_Config::getInstance() : Reporter_Text::getInstance();
            return $reporter;
        }
        else{
            die("this only support the cli mode!!!");
        }
    }
}

?>
